<template>
  <div>
    <p>
      <button @click="list(1)" class="btn btn-white btn-default btn-round">
        <i class="ace-icon fa fa-refresh"></i>
        刷新
      </button>
    </p>
    <pagination ref="pagination" v-bind:list="list"></pagination>
    <table id="simple-table" class="table  table-bordered table-hover">
      <thead>
      <tr>
        <th>ID</th>
        <th>手机号</th>
        <th>验证码</th>
        <th>用途</th>
        <th>生成时间</th>
        <th>用途</th>
      </tr>
      </thead>

      <tbody>
      <tr v-for="sms in smss">
              <td>{{sms.id}}</td>
              <td>{{sms.mobile}}</td>
              <td>{{sms.code}}</td>
              <td>{{SMS_USE | optionKV(sms.use)}}</td>
              <td>{{sms.at}}</td>
              <td>{{SMS_STATUS | optionKV(sms.status)}}</td>
      </tr>
      </tbody>
    </table>

  </div>
</template>

<script>
import Pagination from "../../components/pagination.vue"
export default {
  components: {Pagination},
  name: "business-sms",
  data: function () {
    return {
      sms: {},
      smss: [],
      SMS_USE: SMS_USE,
      SMS_STATUS: SMS_STATUS,
    }
  },
  mounted: function () {
    let _this = this;
    _this.$refs.pagination.size = 5;
    _this.list(1);
    // sidebar激活样式方法一
    // this.$parent.activeSidebar("business-sms-sidebar")
  },
  methods: {
    /**
     * 列表查询
     */
    list(page) {
      let _this = this;
      Loading.show()
      _this.$ajax.post(process.env.VUE_APP_SERVER + '/business/admin/sms/list', {
        page: page,
        size: _this.$refs.pagination.size
      }).then((response)=>{
        Loading.hide()
        //console.log("查询短信验证码列表结果：",response)
        _this.smss = response.data.content.list
        _this.$refs.pagination.render(page, response.data.content.total)
      })
    }
  }
}
</script>

<style scoped>

</style>